home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / lzwp13.zip / LZW4P.DOC < prev    next >
Text File  |  1993-09-09  |  33KB  |  961 lines

  1.  
  2.  
  3.                           LZW Data Compression Library
  4.  
  5.                                 For Turbo Pascal
  6.  
  7.  
  8.                                     (LZW4P)
  9.  
  10.  
  11.  
  12.                                  USERS MANUAL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                    Version 1.3
  19.  
  20.                                   Sept 10, 1993
  21.  
  22.  
  23.  
  24.  
  25.                         This software is provided as-is.
  26.                  There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30.  
  31.                               Copyright (C) 1993
  32.                               All rights reserved
  33.  
  34.  
  35.  
  36.                               MarshallSoft Computing, Inc.
  37.                               Post Office Box 4543
  38.                               Huntsville AL 35815
  39.  
  40.                               205-881-4630  Voice / FAX
  41.                               205-880-9748  Support BBS
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.         LZW4P Users Manual                                     Page 1
  61.                               C O N T E N T S
  62.  
  63.  
  64.  
  65.  
  66.  
  67.          Chapter                                                   Page
  68.  
  69.          1.0 Introduction..............................................3
  70.              1.1 Distribution Files....................................3
  71.              1.2 Compiling the Library.................................4
  72.              1.3 User Support..........................................4
  73.              1.4 Installation..........................................5
  74.          2.0 The LZW Algorithm.........................................6
  75.              2.1 LZW Compression.......................................6
  76.              2.2 LZW Expansion.........................................7
  77.              2.3 LZW Implementation....................................7
  78.          3.0 Example Programs..........................................8
  79.              3.1 COMPRESS..............................................8
  80.              3.2 EXPAND................................................8
  81.              3.3 TEST_LZW..............................................9
  82.              3.4 MK_ARC................................................9
  83.              3.5 UN_ARC................................................9
  84.              3.6 SEE_ARC...............................................9
  85.          4.0 Reader & Writer Functions................................10
  86.          5.0 Library Functions........................................11
  87.              5.1 InitLZW..............................................11
  88.              5.2 TermLZW..............................................11
  89.              5.3 Compress.............................................12
  90.              5.4 Expand...............................................12
  91.          6.0 Error Codes..............................................13
  92.              6.1 EXPANSION_ERROR......................................13
  93.              6.2 CANNOT_ALLOCATE......................................13
  94.              6.3 INTERNAL_ERROR.......................................13
  95.              6.4 NOT_READY............................................13
  96.              6.5 BAD_BITCODE..........................................13
  97.          7.0 Legal Issues.............................................14
  98.              7.1 Registration.........................................14
  99.              7.2 Referral Plan........................................14
  100.              7.3 License..............................................15
  101.              7.4 Warranty.............................................15
  102.          8.0 Revision History.........................................16
  103.          9.0 Other MarshallSoft Computing Products for Pascal.........16
  104.              9.1 The Personal Communications Library for Pascal.......16
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.         LZW4P Users Manual                                     Page 2
  121.          1.0 Introduction
  122.  
  123.  
  124.          LZW4P  consists  of a variable code size implementation of the LZW
  125.          (Lempel-Ziv-Welch) algorithm  for  compressing  and  decompressing
  126.          data.   LZW does particularly well on text files, achieving better
  127.          than a 50 % compression ratio for many files.
  128.  
  129.          The  LZW  algorithm  is  considered  to be one of the best general
  130.          purpose algorithms available today.  The  new  high  speed  modems
  131.          that  employ  on-the-fly  data  compression (such as MNP 5.0 & the
  132.          V.42 bis international standard) use the LZW  algorithm,  as  well
  133.          as such well known utility programs such as PKZIP.
  134.  
  135.          The  LZW4P  library  is  designed  to be used in a wide variety of
  136.          situations. Some of the possible uses include:
  137.  
  138.          1) Compression and expanding files on disk.
  139.          2) Compressing files "on the fly" before  sending  over  a  modem,
  140.             and then expanding on the receiving end.
  141.          3) Compression of data files used by your application program such
  142.             as help files, graphics screens, etc. The compressed data files
  143.             are then expanded as they are loaded by the application.
  144.  
  145.  
  146.          1.1 Distribution Files
  147.  
  148.          The distribution files are as follows:
  149.  
  150.  
  151.           1) LZW4P.DOC    -- This documentation file.
  152.           2) LZW4P.INV    -- Invoice file.
  153.           3) COMPRESS.PAS -- Data compression example program.
  154.           4) EXPAND.PAS   -- Data expansion example program.
  155.           5) LZW4P.PAS    -- Library unit interface.
  156.           6) TEST_LZW.PAS -- LZW test driver program.
  157.           7) MK_ARC.PAS   -- File archiving program.
  158.           8) UN_ARC.PAS   -- File un-archiving program.
  159.           9) RW_IO.PAS    -- Reader/Writer I/O source file.
  160.          10) DIR_IO.PAS   -- Directory I/O source file.
  161.          11) LZW_ERR.PAS  -- Displays text error messages.
  162.          12) MEMORY.PAS   -- Memory allocation functions.
  163.          13) HEX_IO.PAS   -- Procedure to read & write hexidecimal.
  164.          14) LZW4PLIB.OBJ -- Library object file.
  165.  
  166.          Registered users also receive:
  167.  
  168.           1) LZW4PLIB.ASM -- Library source file.
  169.           2) MAKETPU.BAT  -- Makes library object from source.
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.         LZW4P Users Manual                                     Page 3
  181.          1.2 Compiling the Library
  182.  
  183.  
  184.          If you are not running Turbo Pascal 6.0, you may need to recompile
  185.          the library unit as follows:
  186.  
  187.                TPC LZW4P
  188.  
  189.          The registered user can recompile the source code (source code  is
  190.          provided  in  the  registered  version  only)  for  the library as
  191.          follows:
  192.  
  193.                MAKETPU
  194.  
  195.          or
  196.  
  197.                MASM LZW4PLIB.ASM,LZW4PLIB.OBJ /DPASCAL_MODEL;
  198.                TPC LZW4P
  199.  
  200.  
  201.          1.3 User Support
  202.  
  203.          We  want you to be successful in developing your application using
  204.          our libraries! We depend on our customers to let us know what they
  205.          need in a library.  This means we are committed to  providing  the
  206.          best  libraries  that  we  can.   If  you  have any suggestions or
  207.          comments, please write to us or give us a call.
  208.  
  209.          If you are having a problem using LZW4P or any of  our  libraries,
  210.          call  (205)  881-4630  between  5  PM  and 9 PM CST Monday through
  211.          Friday.  You can call at other times and leave a message, and call
  212.          back later during our regular business hours for a reply. You  can
  213.          also FAX us at this same number at any time.
  214.  
  215.          You  may  also  call  our  24  hour  BBS at any time. The BBS will
  216.          contain the latest shareware version of LZW4P, messages, and other
  217.          related files. All files are in  standard  ZIP  format.   You  can
  218.          leave a message on the BBS, and we will usually have a reply ready
  219.          for  you  within  24  hours.   The  dedicated  telephone number is
  220.          205-880-9748.  Set your modem for 1200 to 9600 baud, 8 data  bits,
  221.          no parity, one stop bit.
  222.  
  223.          The  MarshallSoft  Computing,  Inc.   newsletter  "Comm  Talk"  is
  224.          published quarterly.  It discusses various communications problems
  225.          and solutions using PCL (the communications library)  as  well  as
  226.          related  information  such as data compression issues.  Registered
  227.          users receive a one year  complimentary  subscription  when  first
  228.          registering  and  for  each update purchased.  Additional one year
  229.          subscriptions are $15 plus $5 for overseas  postage  (postpaid  in
  230.          US).
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.         LZW4P Users Manual                                     Page 4
  241.          1.4 Installation
  242.  
  243.  
  244.          (1) Make a backup  copy  of  your  distribution  disk.   Put  your
  245.          original distribution disk in a safe place.
  246.  
  247.          (2)  Create  a  work  directory  on  your work disk (normally your
  248.          harddisk). For example, to create a work directory named LZW4P, we
  249.          first log onto the work disk and then type:
  250.  
  251.                                MKDIR LZW4P
  252.  
  253.          (3)  Copy  all the files from your backup copy of the distribution
  254.          disk to your work directory.  For example, to  copy  from  the  A:
  255.          drive to your work directory, we type:
  256.  
  257.                               CD LZW4P
  258.                               COPY A:*.*
  259.  
  260.          (4) The library unit LZW4P.TPU is compiled with Turbo Pascal  6.0.
  261.          If  you  are  using  another  version  (4.0  or above), you should
  262.          recompile the library unit as follows:
  263.  
  264.                TPC LZW4P
  265.  
  266.          (5) Compile COMPRESS.PAS, EXPAND.PAS,  TEST_LZW.PAS,  MK_ARC,  and
  267.          UN_ARC.  For example, to make TEST_LZW.EXE:
  268.  
  269.                TPC TEST_LZW
  270.  
  271.          You  may  want  to run TEST_LZW on some of your files as a test of
  272.          the library functions.
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.         LZW4P Users Manual                                     Page 5
  301.          2.0 The LZW Algorithm
  302.  
  303.  
  304.          The following discussion of the LZW algorithm is meant to  provide
  305.          a  high  level  overview  of  LZW.  For those interested in a more
  306.          detailed explanation, several good books  are  available  on  data
  307.          compression.
  308.  
  309.          The original research papers on what is now called LZW compression
  310.          are:
  311.  
  312.              J. ZIV and A. Lempel,
  313.              "A Universal Algorithm for Sequential Data Compression",
  314.              IEEE Transactions on Information Theory, May 1977.
  315.  
  316.              Terry Welch,
  317.              "A Technique for High-Performance Data Compression",
  318.               Computer, June 1984.
  319.  
  320.  
  321.          2.1 LZW Compression
  322.  
  323.  
  324.          The  LZW  compressor  reads  8-bit  bytes  from  a data source and
  325.          outputs N-bit codes each of which identifies a previously  defined
  326.          string.   The  value  of  N starts at 9. Thus, codes 0 through 255
  327.          ($ff) correspond with the standard character set, while codes  256
  328.          ($100)  through  511  ($1ff)  correspond  to a byte-byte pair or a
  329.          code-byte pair in the code table. After code 511 is output, 10 bit
  330.          codes are used. This is repeated until the maximum number of  bits
  331.          per code is reached. LZW4P can use a maximum of 12, 13, or 14 bits
  332.          per code. The recommended value is 14.
  333.  
  334.          The LZW compressor builds a code table as it compresses data.  The
  335.          code table consists of previously encountered strings.
  336.  
  337.          The basic LZW compression algorithm is as follows:
  338.  
  339.              STRING = get first input byte
  340.              while there is more input data
  341.                {BYTE = get next input byte
  342.                 if STRING+BYTE is in code table
  343.                    STRING=STRING+BYTE
  344.                 else
  345.                   {output code for STRING
  346.                    add STRING+BYTE to code table
  347.                    STRING = BYTE
  348.                   }
  349.               }
  350.              output the code for STRING
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.         LZW4P Users Manual                                     Page 6
  361.          2.2 LZW Expansion
  362.  
  363.  
  364.          The LZW expansion routine reads the N-bit codes previously created
  365.          by  the  LZW  compressor  and  reconstructs  the  code  table  (as
  366.          previously constructed by the compressor) as it is outputing 8-bit
  367.          bytes.   A  code corresponds to a single byte (the first 256 codes
  368.          from $00 through $ff), or a byte-byte pair in the code table, or a
  369.          code-byte pair in the code table. In the later case, the code part
  370.          of the code-byte pair refers to another defined code pair  in  the
  371.          table.   As  each code is read in, it is located in the code table
  372.          and the corresponding 8-bit bytes are  output.   This  means  that
  373.          codes must be defined before they are needed for expansion. Unlike
  374.          older  dictionary  based  compression schemes, the code dictionary
  375.          produced by the compressor routine does not have to be provided to
  376.          the expansion routine.
  377.  
  378.          The basic LZW de-compression algorithm is as follows:
  379.  
  380.              OLDCODE = input first code
  381.              output OLDCODE
  382.              while there is more input data
  383.                {NEWCODE = get next input code
  384.                 STRING = translation of NEWCODE
  385.                 output STRING
  386.                 BYTE = 1st byte of STRING
  387.                 add OLDCODE+BYTE to the code table
  388.                 OLDCODE = NEWCODE
  389.                }
  390.  
  391.          2.3 Implementation
  392.  
  393.  
  394.          The LZW4P library is written in assembly language.  Any  Microsoft
  395.          or  compatible assembler will assemble it. The decision to program
  396.          LZW4P in assembler was made in order to get the  absolute  maximum
  397.          performance  possible.   Although Turbo Pascal is very good, it is
  398.          still bigger and slower than hand optimized assembler.
  399.  
  400.          Using  a  maximum  of 12 bits per code (see the InitLZW function),
  401.          25105 bytes are allocated for table space.  This  value  jumps  to
  402.          45145 bytes when using 13 bits and 90205 bytes when using 14 bits.
  403.          The best compression is given using 14 bits per code.
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.         LZW4P Users Manual                                     Page 7
  421.          3.0 Example Programs
  422.  
  423.  
  424.          Five example programs are provided.  Each example  program  should
  425.          be  compiled  and  tested.   These  example  programs are meant to
  426.          demonstrate various ways in which the LZW compression library  can
  427.          be used.
  428.  
  429.  
  430.          3.1 COMPRESS
  431.  
  432.  
  433.          The  program  COMPRESS  is  provided  as  both  a  standalone  LZW
  434.          compression  program,  and  as  an example of how to use the LZW4P
  435.          library to compress a file. In order to run COMPRESS, type
  436.  
  437.              COMPRESS <infile> <outfile>
  438.  
  439.          For example, to compress LZW4P.DOC to LZW4P.LZW, type
  440.  
  441.              COMPRESS LZW4P.DOC LZW4P.LZW
  442.  
  443.  
  444.          3.2 EXPAND
  445.  
  446.  
  447.          The   program   EXPAND  is  provided  as  both  a  standalone  LZW
  448.          de-compression program, and as an example of how to use the  LZW4P
  449.          library to de-compress a file. In order to run EXPAND, type
  450.  
  451.              EXPAND <infile> <outfile>
  452.  
  453.          For example, to de-compress LZW4P.LZW to LZW4P.DOC, type
  454.  
  455.              COMPRESS LZW4P.LZW LZW4P.DOC
  456.  
  457.          Of course, you can only decompress a file that has been compressed
  458.          with COMPRESS.
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.         LZW4P Users Manual                                     Page 8
  481.          3.3 TEST_LZW
  482.  
  483.  
  484.          The  program  TEST_LZW is used to compress, expand, and verify one
  485.          or more files. It's purpose is for you to test the  LZW4P  library
  486.          on  your  own files.  Your files are never modified.  However, you
  487.          can NOT specify a file named "XXX.XXX" or  "YYY.YYY"  since  these
  488.          files  are  work  files  used by COMPRESS and EXPAND.  Compression
  489.          ratios ( compressed_size / original_size ) are  printed  for  each
  490.          file  compressed.   For  example,  to test all files ending with a
  491.          *.PAS extension:
  492.  
  493.              TEST_LZW *.PAS
  494.  
  495.          After compiling TEST_LZW, run it  against  a  large  directory  of
  496.          files as a test of the library.
  497.  
  498.  
  499.          3.4 MK_ARC
  500.  
  501.  
  502.          The program MK_ARC is used to create an archive file. For example,
  503.          to create an archive named  PASCAL.ARF  consisting  of  all  files
  504.          ending with the extension '.PAS', type:
  505.  
  506.              MK_ARC *.PAS PASCAL.ARF
  507.  
  508.  
  509.          3.5 UN_ARC
  510.  
  511.  
  512.          The  program  UN_ARC  is  used to un-archive the files archived by
  513.          MK_ARC. For example, to un-archive PASCAL.ARF, type:
  514.  
  515.              UN_ARC PASCAL.ARF
  516.  
  517.          Note  that  the  UN_ARC  program  can be modified to provide for a
  518.          customized product installation program.
  519.  
  520.  
  521.          3.6 SEE_ARC
  522.  
  523.  
  524.          The program SEE_ARC is used to list the files in any archive  file
  525.          created with MK_ARC. For example, to see the files in PASCAL.ARF:
  526.  
  527.              SEE_ARC PASCAL.ARF
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.         LZW4P Users Manual                                     Page 9
  541.          4.0 Reader & Writer Functions
  542.  
  543.  
  544.          Both  the  compression and expansion routines in the LZW4P library
  545.          use Reader and Writer functions supplied by  the  library  caller.
  546.          The  user  may replace the supplied Reader and Writer functions as
  547.          long as the following guidelines are followed.
  548.  
  549.          The Reader function always returns the next input  byte  from  the
  550.          input  stream.  The Reader function is not limited to reading from
  551.          disk.  It may read from any data source as long as it returns a -1
  552.          when there is no more data to be read.
  553.  
  554.          Similiarly, the Writer function writes the next output byte to the
  555.          output stream. The writer function may write to any data sink.
  556.  
  557.          The Reader and Writer functions are provided as a  means  to  give
  558.          the caller complete control over the source and destination of the
  559.          data stream during compression and expansion. For example, instead
  560.          of  disk I/O, the Reader and Writer functions could be reading and
  561.          writing to a serial port.
  562.  
  563.          The Pascal procedures BlockRead and BlockWrite are used to  buffer
  564.          disk  I/O  for  the  Reader  and  Writer functions. The Reader and
  565.          Writer functions are defined as follows:
  566.  
  567.              type String12 = String[12];
  568.  
  569.              function ReaderOpen(Filename : String12) : Integer;
  570.              function Reader : Integer;
  571.              function ReaderClose : Integer;
  572.              function ReaderCount : LongInt;
  573.  
  574.              function WriterOpen(Filename : String12) : Integer;
  575.              function Writer(TheByte : Byte) : Integer;
  576.              function WriterClose : Integer;
  577.  
  578.          Note that the Reader returns a -1 for an end  of  data  condition.
  579.          Data is returned as an integer with the high byte set to 0.  Thus,
  580.          the  only  integers  can  can  be  returned  by  the Reader are -1
  581.          ($ffff) and 0 ($0000) to 255 ($00ff).
  582.  
  583.          If  you  remove  data from a character buffer, be sure to zero out
  584.          the high order byte (AND with $00ff) unless you are  returning  a
  585.          -1  (EOF).
  586.  
  587.          See RW_IO.PAS for the Reader / Writer code.
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.         LZW4P Users Manual                                     Page 10
  601.          5.0 Library Functions
  602.  
  603.  
  604.          5.1 InitLZW
  605.  
  606.  
  607.          Function:     Initialize library
  608.  
  609.          Prototype:    function InitLZW(AllocP : Pointer;
  610.                                        BitCode : Integer) : Integer;
  611.  
  612.          Description:  The  InitLZW  function  is  used to initialize the
  613.                        library. The first argument is the function name of
  614.                        a user supplied memory allocation function.
  615.  
  616.                        The  second argument <BitCode> is the maximum number
  617.                        of bits used per code in  the  compression  process.
  618.                        Legal  values  are  12,  13,  and  14 (the preferred
  619.                        value). Smaller values will use less memory but  not
  620.                        compress as tightly.
  621.  
  622.                        See the MEMORY.PAS function.
  623.  
  624.  
  625.          Returns:      -2 : (CANNOT_ALLOCATE) -- if unable to allocate.
  626.                        -5 : (BAD_BITCODE) -- BitCode not 12, 13, or 14.
  627.                         0 : (AOK) -- no error.
  628.  
  629.          Example:      (* initialize LZW4P *)
  630.                        var AllocMemoryP : Pointer;
  631.                        ...
  632.                        AllocMemoryP := @AllocMemory;
  633.                        Code := InitLZW(AllocMemoryP,14);
  634.  
  635.  
  636.          5.2 TermLZW
  637.  
  638.  
  639.          Function:     Terminate library
  640.  
  641.          Prototype:    function TermLZW(FreeP : Pointer) : Integer;
  642.  
  643.  
  644.          Description:  The  TermLZW  function  is  used  to  terminate  the
  645.                        library after all processing is  done.   The  single
  646.                        argument  is  the  function  name of a user supplied
  647.                        memory de-allocation function.  This is primarily  a
  648.                        way   to   free memory allocated by InitLZW. See the
  649.                        MEMORY.PAS function.
  650.  
  651.          Returns:      0 : (AOK) -- no error.
  652.  
  653.          Example:      (* terminate LZW4P *)
  654.                        var FreeMemoryP : Pointer;
  655.                        ...
  656.                        FreeMemoryP := @FreeMemory;
  657.                        Code := TermLZW(FreeMemoryP);
  658.  
  659.  
  660.         LZW4P Users Manual                                     Page 11
  661.          5.3 Compress
  662.  
  663.  
  664.          Function:     Compresses a data set.
  665.  
  666.          Prototype:    function Compress(ReaderP,WriterP:Pointer) :Integer;
  667.  
  668.          Description:  The  Compress  function  is used to compress  a data
  669.                        set.  The Reader function always  returns  the  next
  670.                        input  byte.  The  Writer function consumes the next
  671.                        output byte. Refer to the section  on  Reader/Writer
  672.                        I/O.
  673.  
  674.          Returns:      -4 : (NOT_READY) -- Didn't call InitLZW first.
  675.                         0 : (AOK) -- No error.
  676.  
  677.          Example:      (* compress a file *)
  678.                        Var ReaderP : Pointer;
  679.                            WriterP : Pointer;
  680.                        ...
  681.                        ReaderP := @Reader;
  682.                        WriterP := @Writer;
  683.                        Code := Compress(ReaderP,WriterP);
  684.  
  685.  
  686.          5.4 Expand
  687.  
  688.  
  689.          Function:     Expands a file.
  690.  
  691.          Prototype:    function Expand(ReaderP,WriterP:Pointer) :Integer;
  692.  
  693.          Description:  The  Expand  function is used to de-compress  a file
  694.                        previously compressed with  the  Compress  function.
  695.                        The  Reader  function  always returns the next input
  696.                        byte.  The Writer function consumes the next  output
  697.                        byte.  Refer  to  the  section on Reader/Writer I/O.
  698.  
  699.          Returns:      -1 : (EXPANSION_ERROR)  -- File not compressed by
  700.                              the compress function.
  701.                         0 : (AOK) -- No error.
  702.  
  703.          Example:      (*  de-compress a file *)
  704.                        Var ReaderP : Pointer;
  705.                            WriterP : Pointer;
  706.                        ...
  707.                        ReaderP := @Reader;
  708.                        WriterP := @Writer;
  709.                        Code := Expand(ReaderP,WriterP);
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.         LZW4P Users Manual                                     Page 12
  721.          6.0 Error Codes
  722.  
  723.  
  724.          Be  sure and check the return codes from each LZW4P function call.
  725.          There are only 4 error codes returned by the LZW4P  library  other
  726.          than  0  (no  error). All error codes are negative numbers.  Their
  727.          numerical values are in the LZW4P.PAS file.
  728.  
  729.          Each error code is returned by a library function as follows:
  730.  
  731.          ****************************************************************
  732.          *    Error Name    *  IntLZW  *  TermLZW * Compress *  Expand  *
  733.          ****************************************************************
  734.          * EXPANSION_ERROR  *    No    *    No    *    No    *    Yes   *
  735.          * CANNOT_ALLOCATE  *    Yes   *    No    *    No    *    No    *
  736.          * INTERNAL_ERROR   *    Yes   *    No    *    No    *    No    *
  737.          * NOT_READY        *    No    *    No    *    Yes   *    Yes   *
  738.          * BAD_BITCODE      *    Yes   *    No    *    No    *    No    *
  739.          ****************************************************************
  740.  
  741.  
  742.          6.1 EXPANSION_ERROR
  743.  
  744.          An  EXPANSION_ERROR  error  is returned only by the Expand library
  745.          function. It is caused by attempting to expand a file that was not
  746.          compressed by the Compress function.  Note, however,  that  Expand
  747.          may  expand  a  file  that  was not compressed by Compress without
  748.          returning an EXPANSION error.
  749.  
  750.          6.2 CANNOT_ALLOCATE
  751.  
  752.          A CANNOT_ALLOCATE error is returned only by  the  InitLZW  library
  753.          function.   It is caused when the Alloc function passed to InitLZW
  754.          returns  a  NULL  pointer,  indicating  that  it  cannot  allocate
  755.          sufficient memory.
  756.  
  757.          6.3 INTERNAL_ERROR
  758.  
  759.          An  INTERNAL_ERROR  error  is returned only by the InitLZW library
  760.          function and only in the  shareware  version.   It  is  caused  by
  761.          modification  of  the  Shareware screen. You should never get this
  762.          error.
  763.  
  764.          6.4 NOT_READY
  765.  
  766.          A NOT_READY error is returned by the Compress and  Expand  library
  767.          functions.  It  is  caused  by  calling Compress or Expand without
  768.          first calling InitLZW.
  769.  
  770.          6.5 BAD_BITCODE
  771.  
  772.          A  BAD_BITCODE  error  is  returned  from InitLZW when specifing a
  773.          BitCode of other than 12, 13, or 14.
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.         LZW4P Users Manual                                     Page 13
  781.          7.0 Legal Issues
  782.  
  783.  
  784.          7.1 Registration
  785.  
  786.  
  787.          If you wish to register the LZW4P Library, please send $35 plus $3
  788.          S&H ($6 outside of North America) to:
  789.  
  790.                   MarshallSoft Computing, Inc.
  791.                   Post Office Box  4543
  792.                   Huntsville AL 35815
  793.  
  794.          We accept  American  Express  (account  number,  expiration  date,
  795.          exact  name  on  your  card,  and  complete  AmEx  billing address
  796.          required), checks in US dollars  drawn  on  a  US  bank,  purchase
  797.          orders  (POs)  from  recognized  US schools and companies listed in
  798.          Dun &  Bradstreet,  and  COD  (street  address  and  phone  number
  799.          required)  within  the USA (plus a $3 COD charge).  Print the file
  800.          PCL4C.INV if an invoice  is  needed.
  801.  
  802.          You  can  also  order LZW4P from The Public Software Library (PSL)
  803.          with your MC, Visa, AmEx, or Discover card by calling 800-242-4PSL
  804.          (from overseas: 713-524-6394) or by  FAX  at  713-524-6398  or  by
  805.          CompuServe  at  [71355,470].  THESE NUMBERS ARE FOR ORDERING ONLY.
  806.          The product number for LZW4P is 10911.
  807.  
  808.          If  you  wish  to  update from an older version of LZW4P, send $15
  809.          plus  $3  S&H  ($6 outside  of  North  America).  Updates  must be
  810.          ordered directly from MarshallSoft Computing.
  811.  
  812.          The registered package includes:
  813.  
  814.          o  LZW4P library w/o shareware screen.
  815.          o  Assembler source code for the library.
  816.          o  Laser printed Users Manual.
  817.          o  Telephone / FAX / BBS  support for one year.
  818.  
  819.          Print  the  file LZW4P.INV if an invoice is needed. The registered
  820.          user will receive the latest version of LZW4P shipped by  two  day
  821.          priority  mail  (packet  airmail  overseas).   A 5.25" diskette is
  822.          provided unless a 3.5" diskette is requested.
  823.  
  824.  
  825.          6.2 Referral Program
  826.  
  827.  
  828.          The registered user will receive  a  $5  certificate  towards  any
  829.          MarshallSoft   Computing  product  by  referring  a  new  customer
  830.          (someone who has never  registered  with  us)  paying  full  price
  831.          ($55). The new customer must identify you at the time the order is
  832.          placed.   You  will  be mailed a certificate worth $5 when the new
  833.          registration is paid.
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.         LZW4P Users Manual                                     Page 14
  841.          7.2 License
  842.  
  843.  
  844.          MarshallSoft  Computing,  Inc. grants the registered user of LZW4P
  845.          the right to use  the  LZW4P  library  (in  object  form)  in  the
  846.          development   of  any  software  product  without  any  royalties.
  847.          However,  the  source  code  for  the  library  (LZW4PLIB.ASM)  is
  848.          copyrighted  by  MarshallSoft  Computing,  Inc.,  and  may  not be
  849.          released in whole or in part.
  850.  
  851.  
  852.          7.3 Warranty
  853.  
  854.  
  855.          MARSHALLSOFT COMPUTING, INC. DISCLAIMS ALL WARRANTIES RELATING  TO
  856.          THIS  SOFTWARE,  WHETHER  EXPRESSED  OR IMPLIED, INCLUDING BUT NOT
  857.          LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY  AND  FITNESS
  858.          FOR  A  PARTICULAR  PURPOSE, AND ALL SUCH WARRANTIES ARE EXPRESSLY
  859.          AND SPECIFICALLY DISCLAIMED. NEITHER MARSHALLSOFT COMPUTING,  INC.
  860.          NOR ANYONE ELSE WHO HAS BEEN INVOLVED IN THE CREATION, PRODUCTION,
  861.          OR  DELIVERY  OF  THIS  SOFTWARE SHALL BE LIABLE FOR ANY INDIRECT,
  862.  
  863.          CONSEQUENTIAL, OR INCIDENTAL DAMAGES ARISING OUT  OF  THE  USE  OR
  864.          INABILITY  TO  USE  SUCH  SOFTWARE EVEN IF MARSHALLSOFT COMPUTING,
  865.          INC.  HAS BEEN ADVISED OF  THE  POSSIBILITY  OF  SUCH  DAMAGES  OR
  866.          CLAIMS. IN NO EVENT SHALL MARSHALLSOFT COMPUTING, INC.'S LIABILITY
  867.          FOR ANY SUCH DAMAGES EVER EXCEED THE PRICE PAID FOR THE LICENSE TO
  868.          USE  THE SOFTWARE, REGARDLESS OF THE FORM OF THE CLAIM. THE PERSON
  869.          USING  THE  SOFTWARE  BEARS  ALL  RISK  AS  TO  THE  QUALITY   AND
  870.          PERFORMANCE OF THE SOFTWARE.
  871.  
  872.          Some  states  do not allow the exclusion of the limit of liability
  873.          for consequential or incidental damages, so the  above  limitation
  874.          may not apply to you.
  875.  
  876.          This  agreement  shall  be  governed  by  the laws of the State of
  877.          Alabama and shall inure to the benefit of Marshallsoft  Computing,
  878.          Inc.   and  any successors, administrators, heirs and assigns. Any
  879.          action or proceeding brought by either  party  against  the  other
  880.          arising  out of or related to this agreement shall be brought only
  881.          in a STATE or FEDERAL COURT of competent jurisdiction  located  in
  882.          Madison County, Alabama. The parties hereby consent to in personam
  883.          jurisdiction of said courts.
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.         LZW4P Users Manual                                     Page 15
  901.          8.0 Revision History
  902.  
  903.  
  904.          Version 1.0 -- October 8, 1992
  905.  
  906.          o  Original release (C only).
  907.  
  908.          Version 1.1 -- November 11, 1992  (C only)
  909.  
  910.          o  Added MK_ARC example program.
  911.          o  Added UN_ARC example program.
  912.  
  913.          Version 1.2 -- March 1, 1993  (1st release of PASCAL version)
  914.  
  915.          o  SEE_ARC example program added.
  916.          o  Minor speed improvements.
  917.  
  918.          Version 1.3 -- Sept 10, 1993
  919.  
  920.          o  Added BitCode parameter to InitLZW.
  921.  
  922.  
  923.          9.0 Other MarshallSoft Computing Products for Pascal
  924.  
  925.  
  926.          Shareware versions of  all  MarshallSoft  Computing  products  are
  927.          available on our user support BBS 205-880-9748.
  928.  
  929.          9.1 The Personal Communications Library for Pascal
  930.  
  931.  
  932.          The Personal Communications Library for the Pascal (PCL4P)  is  an
  933.          asynchronous   communications  library  designed  for  experienced
  934.          software developers programming in Turbo Pascal. The PCL features:
  935.  
  936.          o 33 communications and support functions.
  937.          o Support for the high performance INS16550 UART.
  938.          o Supports hardware (RTS/CTS) flow control.
  939.          o Interrupt driven tranmitter (optionally) & receiver.
  940.          o Supports 300 baud to 115,200 baud.
  941.          o Supports COM1, COM2, COM3, and  COM4.
  942.          o Adjustable receive queues from 8 bytes to 32 KB.
  943.          o Control-BREAK error exit.
  944.          o 17 communications error conditions trapped.
  945.          o Allows 4 ports to run concurrently.
  946.          o Complete modem control & status.
  947.          o Written in assembly language for small size & high speed.
  948.          o Terminal program featuring XMODEM, YMODEM, & YMODEM-G.
  949.  
  950.          The   Personal   Communications  Library  for  Pascal  (PCL4P)  is
  951.          available for $55 plus  $3  S&H  ($6  S&H  overseas).
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.         LZW4P Users Manual                                     Page 16
  961.